package com.fengxing.ams.web.facade;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.fengxing.ams.web.facade.intf.IWordFacade;
import com.fengxing.ams.web.facade.mouble.word.IWordDAO;
import com.fengxing.ams.web.facade.mouble.word.ProfessionalWordVO;

@Service
public class WordFacade implements IWordFacade {

	@Autowired
	private IWordDAO wordDAO;

	@Override
	public List<ProfessionalWordVO> findAll() {
		 return this.wordDAO.findAllWords();
	}

	@Override
	public ProfessionalWordVO findOne(Integer id) {
		return this.wordDAO.findOne(id);
	}

	@Override
	public List<ProfessionalWordVO> findHotWords() {
		return this.wordDAO.findhotWords();
	}

	@Transactional(readOnly=false)
	public void wordShow(Integer id) {
		this.wordDAO.updateWeight(id);
	}

	@Transactional(readOnly=false)
	public void addWord(ProfessionalWordVO vo) {
		vo.setEnable(0);
		vo.setWeight(5);
		
		this.wordDAO.save(vo);
	}
	
}